package listbyorder.access201_300.test201;

/**
 * @author code_yc
 * @version 1.0
 * @date 2020/6/18 10:58
 */
public class Solution {

    public int rangeBitwiseAnd(int m, int n) {
        if(m == Integer.MAX_VALUE) {
            return m;
        }

        int res = m;
        for (int i = m + 1; i <= n; i++) {
            res &= i;
            if(res == 0 || i == Integer.MAX_VALUE){
                break;
            }
        }
        return res;
    }
}
